package com.ruoyi.project.system.memberduties.service.impl;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.project.system.memberduties.domain.MemberDuties;
import com.ruoyi.project.system.memberduties.mapper.MemberDutiesMapper;
import com.ruoyi.project.system.memberduties.service.IMemberDutiesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
 * 申请捆绑企业职务Service业务层处理
 *
 * @author LCL
 * @date 2022-01-04
 */
@Service
public class MemberDutiesServiceImpl implements IMemberDutiesService
{
    @Autowired
    private MemberDutiesMapper memberDutiesMapper;

    /**
     * 查询申请捆绑企业职务
     *
     * @param id 申请捆绑企业职务ID
     * @return 申请捆绑企业职务
     */
    @Override
    public MemberDuties selectMemberDutiesById(String id)
    {
        return memberDutiesMapper.selectMemberDutiesById(id);
    }

    /**
     * 查询申请捆绑企业职务列表
     *
     * @param memberDuties 申请捆绑企业职务
     * @return 申请捆绑企业职务
     */
    @Override
    public List<MemberDuties> selectMemberDutiesList(MemberDuties memberDuties)
    {
        return memberDutiesMapper.selectMemberDutiesList(memberDuties);
    }

    /**
     * 新增申请捆绑企业职务
     *
     * @param memberDuties 申请捆绑企业职务
     * @return 结果
     */
    @Override
    public int insertMemberDuties(MemberDuties memberDuties)
    {
        memberDuties.setId(UUID.randomUUID().toString().replace("-",""));
        memberDuties.setCreatedTime(new Date());
        memberDuties.setStatus(1);
        memberDuties.setDelFlag(0);
        return memberDutiesMapper.insertMemberDuties(memberDuties);
    }

    /**
     * 修改申请捆绑企业职务
     *
     * @param memberDuties 申请捆绑企业职务
     * @return 结果
     */
    @Override
    public int updateMemberDuties(MemberDuties memberDuties)
    {
        return memberDutiesMapper.updateMemberDuties(memberDuties);
    }

    /**
     * 删除申请捆绑企业职务对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteMemberDutiesByIds(String ids)
    {
        return memberDutiesMapper.deleteMemberDutiesByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除申请捆绑企业职务信息
     *
     * @param id 申请捆绑企业职务ID
     * @return 结果
     */
    @Override
    public int deleteMemberDutiesById(String id)
    {
        return memberDutiesMapper.deleteMemberDutiesById(id);
    }
}
